package com.ymttest.database.mongo;

import java.util.ArrayList;
import java.util.Date;
import java.util.Map;

import com.ymt.database.MongoDBDriver;
import com.ymttest.utils.MapUtil;

/************************************************************************************
 * @File name :LiveProductInfoWapper.java
 * @Author : xujiewei
 * @Date : 2016年6月28日
 * @Copyright : 洋码头
 * 商品合库 新库
 ************************************************************************************/
public class ProductDescriptionModelWapper {
	MongoDBDriver mdd = YmtMongoDriverFactroy.getInstance_YmtProductDBdriverNew("ProductDescriptionModel");

	public ProductDescriptionModelWapper()  {
	}
		

	public Map<String,Object> getProductId(String productId) throws Exception {
		ArrayList<Map> list = mdd.selectPartLimitToMap("{\"ProductId\":\"" + productId + "\"}",1);
	    
	    return list.size()>0?list.get(0):null;
	}
	    
	
	public boolean update(Map<String, Object> searchMap,Map<String, Object> updateMap) throws Exception{
		return  mdd.update(searchMap, updateMap).isUpdateOfExisting();
	}
	
	
	public int getCountByProductId(String productId) throws Exception{
		return mdd.selectPartLimitToMap("{\"ProductId\":\"" + productId + "\"}",50).size();
	}
	
	
	public static void main(String[] args) throws Exception {
		
		Map<String,Object> a= new ProductDescriptionModelWapper().getProductId("3b4eb486-e029-4873-b367-8dc4e6da4f30");
		System.out.println(a);
		
		//Mongo
		
	}    
	
	    
		    	
	
	    
}
